package com.training.java.core.collections.pre15;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * This object is to observe the list behavior with School object Added
 * different schools and read the values
 * 
 * @author soumya
 * 
 */
public class SchoolMutableDemo {

	public static void main(String[] args) {

		SchoolMutable school1 = new SchoolMutable("Ruskin", "San Jose", 7);
		SchoolMutable school2 = new SchoolMutable("Cherrywood", "Milpitas", 6);
		SchoolMutable school3 = new SchoolMutable("Curtner", "Milpitas", 8);

		List schools = new ArrayList();

		// Adding schools to the list
		schools.add(school1);
		schools.add(school2);
		schools.add(school3);

		// reading the list

		Iterator<SchoolMutable> it = schools.listIterator();

		System.out.println(" Schools and Ranking ");
		System.out.println(" ");

		while (it.hasNext()) {
			SchoolMutable school = (SchoolMutable) it.next();

			System.out.println("School Name :" + school.getName());
			System.out.println("School city :" + school.getCity());
			System.out.println("School Ranking :"
					+ school.getGreatSchoolRanking());
			System.out.println(" ");

		}

	}

}
